From: | Paul Hill |
Date: | 01 Apr 00 at 05:51:09 |
Subject: | Re: endian code donations? |
On 31-Mar-00 16:33:58, Steven Dobbs wrote:
>Hello Allan
>On 31-Mar-00, you wrote:
>> On 31-Mar-00, David McMinn wrote:
>>
>>> If you have an int, you can do it like this, although this looks real
>>> nasty
>>
>> Since he was using Linux then he could also use htonl() and ntohl().
>>
>Could I? what is confusing me is that I thought that the msb and lsb were
>swapped on the different CPU types - why then does a byte not need to be
>swapped - I would have thought the entire binary sequence of the number
>would have to be reversed.
No, just the ordering of the bytes. The little endian sequence used by
Intel just stores bytes in a really stupid format, that's all.
These might be of help:
/*
* Little endian <==> big endian 32-bit swap macros.
* M_32_SWAP swap a memory location
* P_32_SWAP swap a referenced memory location
* P_32_COPY swap from one location to another
*/
#define M_32_SWAP(a) { \
}
#define P_32_SWAP(a) { \
}
#define P_32_COPY(a, b) { \
}
/*
* Little endian <==> big endian 16-bit swap macros.
* M_16_SWAP swap a memory location
* P_16_SWAP swap a referenced memory location
* P_16_COPY swap from one location to another
*/
#define M_16_SWAP(a) { \
}
#define P_16_SWAP(a) { \
}
#define P_16_COPY(a, b) { \
}
------------------------------------------------------------------------
Get a NextCard Visa, in 30 seconds!
1. Fill in the brief application
2. Receive approval decision within 30 seconds
3. Get rates as low as 2.9% Intro or 9.9% Fixed APR
Apply NOW!
http://click.egroups.com/1/975/1/_/451227/_/954717523/
------------------------------------------------------------------------